/**
 *    Copyright 2009-2020 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.apache.ibatis.aapl.util;

import java.util.LinkedList;
import java.util.List;

/**
 * @author gu
 * @date 2020/5/26 9:14
 */
public class Clause {

  private List<String> except = new LinkedList<>();

  private String where;

  private String orderBy;

  private String search;

  private String equal ;

  private Clause equal(String equal){
    this.equal = equal ;
    return this;
  }

  public String equal(){
    return equal;
  }

  public Clause search(String search){
    this.search = search;
    return this;
  }

  public String search(){
    return search;
  }

  public Clause except(String str) {
    if (str == null || str.length() == 0) {
      return this;
    }
    str = str.trim();
    if (str.length() == 0) {
      return this;
    }
    except.add(str);
    return this;
  }

  public Clause where(String str) {
    where = str;
    return this;
  }

  public Clause orderBy(String str) {
    orderBy = str;
    return this;
  }

  public List<String> except() {
    return except;
  }

  public String where() {
    return where;
  }

  public String orderBy() {
    return orderBy;
  }
}
